"""
配置文件
"""
import os
from pathlib import Path

# 数据库配置
MONGODB_HOST = os.getenv('MONGODB_HOST', 'localhost')
MONGODB_PORT = int(os.getenv('MONGODB_PORT', '27017'))
MONGODB_USERNAME = os.getenv('MONGODB_USERNAME', 'admin')
MONGODB_PASSWORD = os.getenv('MONGODB_PASSWORD', 'your_secure_password')
MONGODB_AUTH_SOURCE = 'admin'
DB_NAME = os.getenv('DB_NAME', 'git_assistant')

# MongoDB连接URI（包含认证信息）
MONGODB_URI = f"mongodb://{MONGODB_USERNAME}:{MONGODB_PASSWORD}@{MONGODB_HOST}:{MONGODB_PORT}/{DB_NAME}?authSource={MONGODB_AUTH_SOURCE}"

# Git仓库配置
REPO_PATH = os.getenv('REPO_PATH', '')
DEFAULT_BRANCH = 'main'

# GitLab配置
GITLAB_URL = os.getenv('GITLAB_URL', 'https://gitlab.com')
GITLAB_TOKEN = os.getenv('GITLAB_TOKEN', '')
GITLAB_PROJECT_ID = os.getenv('GITLAB_PROJECT_ID', '')

# 日志配置
LOG_LEVEL = 'INFO'
LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
LOG_FILE = Path(__file__).parent.parent.parent / 'logs' / 'crawler.log'

# 爬虫配置
BATCH_SIZE = 100  # 每批处理的提交数量
MAX_RETRIES = 3   # 失败重试次数 